<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * @version $Id: edit_form_matches.tpl.php 1227 2008-07-14 11:24:14Z julienv $
 * @package Joomleague
 * @copyright Copyright (C) 2007  JoomLeague
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see _joomleague_license.txt
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 
//$mainframe->addCustomHeadTag( '<script src="'.JL_URL_FOLDER.'/js/mootools.v1.1.js" type="text/javascript" charset="utf-8"></script>' );
	  $output = '<style>
	             #log_res.ajax-loading {
	              padding: 20px 0;
	              background: url(';
	$output .= JL_URL_FOLDER.'/frontend/default/images/spinner.gif) no-repeat center;}
</style>';
$mainframe->addCustomHeadTag( $output );
$mainframe->addCustomHeadTag( '
   <script src="'. JL_URL_FOLDER.'/js/JL_eventsediting.js" type="text/javascript"></script>
   <script src="'. JL_URL_FOLDER.'/js/joomleague.js" type="text/javascript"></script>
   <link rel="stylesheet" type="text/css" media="all" href="'._JOOMLA_JL_LIVE_SITE.'/includes/js/calendar/calendar-mos.css" title="green" />
   <!-- import the calendar script -->
		<script language="javascript" type="text/javascript" src="'._JOOMLA_JL_LIVE_SITE.'/includes/js/calendar/calendar_mini.js"></script>
		<!-- import the language module -->
		<script language="javascript" type="text/javascript" src="'._JOOMLA_JL_LIVE_SITE.'/includes/js/calendar/lang/calendar-en.js"></script>
	  	<script language="javascript" type="text/javascript" src="'._JOOMLA_JL_LIVE_SITE.'/includes/js/overlib_mini.js"></script>
<script language="javascript" type="text/javascript">

  function submitbutton(pressbutton) {
  	var form = document.adminForm;
  	if (pressbutton == "cancel") {
  		submitform( pressbutton );
  		return;
  	}
  
  	// do field validation
  	if (form.name.value == "") {
  		alert( "'._JL_ADMIN_EDIT_FORM_MATCHES_JS_CHECK.'" );
  	} else {
      <?php getEditorContents( "editor1", "summary" ) ; ?>
  		submitform( pressbutton );
  	}
  }
    
</script>
<!-- Query if result exists, if not disable radio button for alt decision-->    
<script language="javascript" type="text/javascript">
    function FormSwitch(action) {
    if (action == 1) {
      disabled = false;
    }
    else {
      disabled = true;
    }
    document.adminForm.matchpart1_result_decision.disabled=disabled;
    document.adminForm.matchpart2_result_decision.disabled=disabled;
    document.adminForm.decision_info.disabled=disabled;
    }
</script>
   ' );
?>
<form name="match" action=""><input type="hidden" id="mdd"
   value="index3.php?option=com_joomleague&act=editEvents&p=<?php echo $project->id.'&mid='.$row->match_id.'&no_html=1';?>" /></form>

<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

<div id="right">
	<div id="rightpad">
	
<!-- Header START -->	
		<div id="step">
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
				<div class="far-right">
							<div class="button1-left"><div class="help"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_MANUAL;?>" title="<?php echo _JL_ADMIN_MANUAL;?>" target="blank"><?php echo _JL_ADMIN_MANUAL;?></a></div></div>
							<div class="button1-left"><div class="forum"><a href="http://www.joomleague.de/forum/" alt="<?php echo _JL_ADMIN_FORUM;?>" title="<?php echo _JL_ADMIN_FORUM;?>" target="blank"><?php echo _JL_ADMIN_FORUM;?></a></div></div>
							<div class="button1-left"><div class="about"><a href="http://www.joomleague.de" alt="<?php echo _JL_ADMIN_INFO;?>" title="<?php echo _JL_ADMIN_INFO;?>" target="blank"><?php echo _JL_ADMIN_INFO;?></a></div></div>
				</div>
				<div class="button1-left"><div class="blank"><a href="index2.php?option=com_joomleague"></a></div></div><span class="step"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_MATCHES;?></span>
			</div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
    </div>
<!-- Header END -->    

    <div id="installer">
 
			<div class="t">
        <div class="t">
          <div class="t"></div>
        </div>
      </div>
      <div class="m" align="left">
      
        <form action="index2.php" method="post" name="adminForm">
        
        <!-- Title 1 START -->    
      	<h2><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_TITLE;?></h2>		
				<!-- Title 1 END -->      
				      		 
				<!-- Info 1 START --> 			
				<div id="step">
					<div class="t">
		        <div class="t">
		          <div class="t"></div>
		        </div>
		      </div>
		      <div class="m" align="left">
						<table class="content" cellpadding="4">
						 <tr>
						  <td><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_HINT1;?>
						  </td>
						 </tr>
						</table>
					</div>
		      <div class="b">
		        <div class="b">
		          <div class="b"></div>
		        </div>
		      </div>
		    </div>
		    <!-- Info 1 END -->

				<!-- Content 1 START -->
				<?php
				list($datum, $uhrzeit)=split(" ", $row->match_date); ?>
					<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
					<tr>
							<td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_NR;?></td>
							<td>
								<input type="text" class="inputbox" name="match_number" value="<?php echo $row->match_number;?>" size="3" /><br />
					</tr>
					<tr>
						<td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_DATE;?></td>
						<td>
							<input type="text" class="inputbox" name="match_date" id="match_date" size="10" value="<?php echo $datum; ?>" />
				      <input type="reset" class="inputbox" class="button" value="..." onclick="return showCalendar('match_date', 'y-mm-dd');" /><br />
							<input type="text" class="inputbox" name="match_time" size="8" value="<?php echo $uhrzeit; ?>" />
						</td>
					</tr>
				  <tr>
						<td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_HOME;?></td>
						<td><b><?php echo $team1->name; ?></b></td>
					</tr>
			    <tr>
						<td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_AWAY;?></td>
						<td><b><?php echo $team2->name; ?></b></td>
					</tr>
			    <tr>
						<td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_GOALS_HOME;?></td>
						<td><input type="text" class="inputbox" name="matchpart1_result" size="3" value="<?php echo $row->matchpart1_result; ?>" /></td>
					</tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_GOALS_AWAY;?></td>
			      <td><input type="text" class="inputbox" name="matchpart2_result" size="3" value="<?php echo $row->matchpart2_result; ?>" /></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_BONUS." "._JL_ADMIN_EDIT_FORM_MATCHES_HOME;?></td>
			      <td>
			        <input type="text" style="font-size:9px;" name="matchpart1_bonus" 
			       value="<?php echo $row->matchpart1_bonus;?>" size="3" class="inputbox" />
			      </td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_BONUS." "._JL_ADMIN_EDIT_FORM_MATCHES_AWAY;?></td>
			      <td>
			        <input type="text" style="font-size:9px;" name="matchpart2_bonus" 
			       value="<?php echo $row->matchpart2_bonus;?>" size="3" class="inputbox" />
			      </td>
			    </tr>
			    <?php 
			      if ($project->use_legs == 1) { ?>
			        <tr>
						<td align="right"><?php echo "Legs Home";?></td>
						<td><input type="text" class="inputbox" name="matchpart1_legs" size="3" value="<?php echo $row->matchpart1_legs; ?>" /></td>
					</tr>
			    <tr>
			      <td align="right"><?php echo "Legs Away";?></td>
			      <td><input type="text" class="inputbox" name="matchpart2_legs" size="3" value="<?php echo $row->matchpart2_legs; ?>" /></td>
			    </tr>
			      <?php } ?>
			    <?php 
			      if ($project->game_parts > 1) { ?>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_MATRIX_ROUNDS_PART_RESULT;?></td>
			      <td>
			        <?php
			        $row->editPart_results (null, &$project);
			        ?>
						</td>
			    </tr>
			      <?php } ?>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_RESULT_NOTICE;?></td>
			      <td><input type="text" class="inputbox" name="match_result_detail" size="30" value="<?php echo $row->match_result_detail; ?>" /></td>
			    </tr>
			    <tr>
			      <td align='right'><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_RESULT_DECISION; ?></td>
			      <td><?php echo mosHTML::yesnoRadioList('alt_decision', 'onclick="javascript:FormSwitch(this.value)"', $row->alt_decision );?></td>
					</tr>
				    <tr>
						<td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_HOME_NEW;?></td>
						<td><input type="text" class="inputbox" name="matchpart1_result_decision" size="3" value="<?php if ($row->alt_decision == 1) if (isset($row->matchpart1_result_decision)) echo $row->matchpart1_result_decision; else echo 'X'; ?>" <?php if ($row->alt_decision == 0) echo 'DISABLED ' ?>/></td>
					</tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_AWAY_NEW;?></td>
			      <td><input type="text" class="inputbox" name="matchpart2_result_decision" size="3" value="<?php if ($row->alt_decision == 1) if (isset($row->matchpart2_result_decision))  echo $row->matchpart2_result_decision; else echo 'X'; ?>" <?php if ($row->alt_decision == 0) echo 'DISABLED ' ?>/></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_NOTICE_NEW;?></td><?php if (is_null($row->matchpart1_result) or ($row->alt_decision == 0)) $disinfo='DISABLED '; ?>
			      <td><input type="text" class="inputbox" name="decision_info" size="30" value="<?php if ($row->alt_decision == 1) echo $row->decision_info; ?>" <?php if ($row->alt_decision == 0) echo 'DISABLED ' ?>/></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_COUNT_MATCH;?></td>
			      <td><?php echo mosHTML::yesnoRadioList('count_result', '', $row->count_result );?></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_PUBLISHED;?></td>
			      <td><?php echo mosHTML::yesnoRadioList('published', '', $row->published );?></td>
			    </tr>
			   </table>
			   <!-- Content 1 END -->

        <!-- Title 3 START --> 
        <div class="newsection"></div>
        <h2><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_TITLE2;?></h2>
        <!-- Title 3 END -->        

		    <!-- Info 3 START -->       
		    <div id="step">
		      <div class="t">
		        <div class="t">
		          <div class="t"></div>
		        </div>
		      </div>
		      <div class="m" align="left">
						<table class="content" cellpadding="4">
						 <tr>
						  <td><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_HINT2;?>
						  </td>
						 </tr>
						</table>
		      </div>
		      <div class="b">
		        <div class="b">
		          <div class="b"></div>
		        </div>
		      </div>
		    </div>
		    <!-- Info 3 END -->

        <!-- Content 3 START -->    
        <div class="install-text2">
			  <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_REFEREE;?></td>
			      <td></td>
			      <td align="left"><?php echo $refereelist;?></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_CROWD;?></td>
			      <td></td>
			      <td align="left"><input type="text" name="crowd" size="6" value="<?php echo $row->crowd; ?>"></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_SHOW_MATCHREPORT;?></td>
			      <td></td>
			      <td align="left"><?php echo mosHTML::yesnoRadioList('show_report', '', $row->show_report );?></td>
			    </tr>
			    <tr>
			      <td align="right"><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_MATCHREPORT;?></td>
			      <td></td>
			      <td align="left">
			<?php
			      // parameters : areaname, content, hidden field, width, height, rows, cols
			      editorArea( 'editor1',  $row->summary , 'summary', '600', '300', '50', '5' ) ; 
			?>
			      </td>
			    </tr>
			    </table> 
          </div>
          <!-- Content 3 END -->  
          
        <input type="hidden" name="match_id" value="<?php echo $row->match_id; ?>" />
	      <input type="hidden" name="option" value="<?php echo JL_OPTION; ?>" />
	      <input type="hidden" name="act" value="<?php echo JL_ACTION;?>" />
	      <input type="hidden" name="task" value="" />
	      </form>

        <!-- Title 2 START --> 
        <div class="newsection"></div>
        <h2><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_LINEUPANDEVENTS;?></h2>
        <!-- Title 2 END -->        

		    <!-- Info 2 START -->       
		    <div id="step">
		      <div class="t">
		        <div class="t">
		          <div class="t"></div>
		        </div>
		      </div>
		      <div class="m" align="left">
						<table class="content" cellpadding="4">
						 <tr>
						  <td><?php echo _JL_ADMIN_EDIT_FORM_MATCHES_LINEUPANDEVENTS_HINT;?>
						  </td>
						 </tr>
						</table>
		      </div>
		      <div class="b">
		        <div class="b">
		          <div class="b"></div>
		        </div>
		      </div>
		    </div>
		    <!-- Info 2 END -->

        <!-- Content 2 START -->    
        <div class="install-text2">
	        <div id="log_res"></div>
	        <div id="eventscontainer"></div>
	        <script language="javascript" type="text/javascript">
	        jl_load_new_match_events(document.getElementById('mdd'), 'eventscontainer');
	        </script>
        </div>
        <!-- Content 2 END -->  

        <div class="clr"></div>
      </div>
      <div class="b">
        <div class="b">
          <div class="b"></div>
        </div>
      </div>
		</div>
	</div>
</div>
<div class="clr"></div>

